<%@ page language="java" contentType="text/html; charset=GBK"
    pageEncoding="GBK"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=GBK">
<title>Delivery Management</title>
</head>

<script type="text/javascript">
	function transaction(transCode){
		var url = "<%=request.getContextPath() %>/transaction.do?method=transaction&transCode="+transCode;
		fm.action = url;
		fm.submit();
	}

	function viewTrans(transCode){
		var url = "<%=request.getContextPath()%>/transaction.do?method=view&transCode="+transCode;
		window.open(url,"","height=500,width=600,top=100,left=200");
	}

	function queryAll_(){
		fm.action = "<%=request.getContextPath() %>/"+fm.action+"?method=query";
		fm.submit();
	}
</script>

<body>
	<form action="transaction.do" name="TransactionForm" method="POST">
		<input type="hidden" name="" value="">
		<table width="100%" cellpadding="5" cellspacing="1" border="1">
			<tr>
				<td colspan="8" align="center"><B>TransactionForm</B></td>
			</tr>
			<tr>
				<td align="center"><b>TransactionCode</b></td>
				<td align="center"><b>client name</b></td>
				<td align="center"><b>client telephone</b></td>
				<td align="center"><b>Amount paid</b></td>
				<td align="center"><b>Transaction status</b></td>
				<td align="center"><b>bookDateStart</b></td>
				<td align="center"><b>finishDateStart</b></td>
				<td align="center"><b>operation</b></td>
			</tr>
			<c:forEach items="${col}" var="one" varStatus="status">
				<tr>
					<td>${one.transCode }</td>
					<td>&nbsp;${one.customerName }</td>
					<td>&nbsp;${one.customerMobile }</td>
					<td>&nbsp;${one.payAmount }</td>
					<td>
					<c:choose>
						<c:when test="${one.transStatus == 0}">
							No shipping
						</c:when>
						<c:otherwise>
							Have been shipped
						</c:otherwise>
					</c:choose>
					</td>
					<td nowrap>&nbsp;${one.bookDate }</td>
					<td nowrap>&nbsp;${one.finishDate }</td>
					<td>
						<c:choose>
							<c:when test="${one.transStatus == 1}">
								<input type="button" name="but" value="shipping" onclick="transaction('${one.transCode}')" disabled>&nbsp;
							</c:when>
							<c:otherwise>
								<input type="button" name="but" value="shipping" onclick="transaction('${one.transCode}')">&nbsp;
							</c:otherwise>
						</c:choose>
						<input type="button" name="view" value="View" onclick="viewTrans('${one.transCode}')">
					</td>
				</tr>
			</c:forEach>
		</table>
		<jsp:include page="../util/SplitPage.jsp"></jsp:include>
		<br>
		<table width="100%" cellpadding="5" cellspacing="1">
			<tr>
				<td align="center"><input type="button" value="query" onclick="queryAll_()"></td>
			</tr>
		</table>
	</form>
</body>
<script type="text/javascript">
	var fm = TransactionForm;
</script>
</html>